# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=pyqt5-sip
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-python-sip"
           "${MINGW_PACKAGE_PREFIX}-python-sip4")
replaces=("${MINGW_PACKAGE_PREFIX}-python-sip"
          "${MINGW_PACKAGE_PREFIX}-python-sip4")
pkgver=12.8.1
pkgrel=2
pkgdesc="The sip extension module provides support for the PyQt5 package (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
license=('GPL')
url="https://riverbankcomputing.com/software/pyqt"
depends=("${MINGW_PACKAGE_PREFIX}-python")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-python-setuptools")
options=('strip' 'staticlibs')
source=(https://pypi.python.org/packages/source/P/PyQt5_sip/PyQt5_sip-${pkgver}.tar.gz)
sha256sums=('30e944db9abee9cc757aea16906d4198129558533eb7fadbe48c5da2bd18e0bd')

prepare() {
  cd "${srcdir}"
  rm -rf python-build-${MINGW_CHOST} | true
  cp -r "PyQt5_sip-${pkgver}" "python-build-${MINGW_CHOST}"
}

build() {
  cd python-build-${MINGW_CHOST}
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py build
}

package(){
  cd "${srcdir}"/python-build-${MINGW_CHOST}
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} \
    --root="${pkgdir}" --optimize=1 --skip-build
}
